﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Omniscient.TimeTracker.Data;
using Omniscient.TimeTracker.BusinessModel.Commands;
using Omniscient.Foundation.Data;
using Omniscient.Foundation.ApplicationModel;

namespace Omniscient.TimeTracker
{
    /// <summary>
    /// Interaction logic for NotfierMenu.xaml
    /// </summary>
    public partial class NotifierContextMenu : ContextMenu
    {
        public NotifierContextMenu()
        {
            InitializeComponent();

            this.Resources.Add("commandStartTask", ApplicationManager.Current.ObjectContainer.Get<StartTaskCommand>());
            this.Resources.Add("commandChangeCategory", ApplicationManager.Current.ObjectContainer.Get<ChangeTaskCategoryCommand>());
            this.Resources.Add("commandStopTask", ApplicationManager.Current.ObjectContainer.Get<StopTaskCommand>());

            this.Resources.Add("commandCreateTask", new NonExecutableCommand());

            MenuStartTask.ItemsSource = ApplicationManager.Current.ObjectContainer.Get<EntityList<Client>>();
            MenuChangeTaskCategory.ItemsSource = ApplicationManager.Current.ObjectContainer.Get<EntityList<Category>>();
        }

        private void menuAddNewTaskClick(object sender, RoutedEventArgs e)
        {
            System.Windows.MessageBox.Show("Add a new task to a project...", "Add new task", MessageBoxButton.OK);
        }
    }

    public class NonExecutableCommand : ICommand
    {
        #region ICommand Members

        public bool CanExecute(object parameter)
        {
            return false;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            throw new NotImplementedException();
        }

        #endregion
    }


}
